Skip to content

mark errors as limit error#2048

Merged
ettec merged 5 commits into
mainfrom
common-limit-errors
May 13, 2026
Merged

mark errors as limit error#2048
ettec merged 5 commits into
mainfrom
common-limit-errors

Conversation

@ettec
Copy link
Copy Markdown
Contributor

@ettec ettec commented May 12, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

✅ API Diff Results - github.com/smartcontractkit/chainlink-common

✅ Compatible Changes (1)

pkg/capabilities/errors (1)
  • NewLimitExceededError — ➕ Added

📄 View full apidiff report

@ettec ettec marked this pull request as ready for review May 12, 2026 16:02
@ettec ettec requested a review from a team as a code owner May 12, 2026 16:02
Copilot AI review requested due to automatic review settings May 12, 2026 16:02
@ettec ettec enabled auto-merge May 12, 2026 16:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a common marker interface for settings “limit” errors so they can be programmatically detected via errors.As, and adds a capability-layer helper to wrap limit breaches as public user errors.

Changes:

  • Added limits.LimitError marker interface and implemented it across existing limit-related error types.
  • Added unit tests ensuring errors.As detects all limit error types (including when wrapped).
  • Added capabilities/errors.NewLimitBreachedError to create a LimitExceeded capability error from a limits.LimitError.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
pkg/settings/limits/errors.go Introduces LimitError and tags existing limit-related error types with it.
pkg/settings/limits/errors_test.go Adds positive/negative tests for detecting LimitError via errors.As.
pkg/capabilities/errors/error.go Adds NewLimitBreachedError constructor wrapping a limits.LimitError as a capability error with LimitExceeded.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/capabilities/errors/error.go Outdated
Comment on lines +117 to +121
// NewLimitBreachedError creates a public user error that embeds the provided limit error, indicating that a CRE limit
// breach has occurred. The error message will include the provided errorMsg as a prefix for additional context.
func NewLimitBreachedError(errorMsg string, err limits.LimitError) Error {
return NewPublicUserError(fmt.Errorf("%s: %w", errorMsg, err), LimitExceeded)
}
Comment thread pkg/capabilities/errors/error.go Outdated
Comment on lines +117 to +121
// NewLimitBreachedError creates a public user error that embeds the provided limit error, indicating that a CRE limit
// breach has occurred. The error message will include the provided errorMsg as a prefix for additional context.
func NewLimitBreachedError(errorMsg string, err limits.LimitError) Error {
return NewPublicUserError(fmt.Errorf("%s: %w", errorMsg, err), LimitExceeded)
}
Comment thread pkg/capabilities/errors/error.go Outdated
Comment on lines +117 to +121
// NewLimitBreachedError creates a public user error that embeds the provided limit error, indicating that a CRE limit
// breach has occurred. The error message will include the provided errorMsg as a prefix for additional context.
func NewLimitBreachedError(errorMsg string, err limits.LimitError) Error {
return NewPublicUserError(fmt.Errorf("%s: %w", errorMsg, err), LimitExceeded)
}
Comment thread pkg/capabilities/errors/error.go Outdated
@ettec ettec force-pushed the common-limit-errors branch from e67f34d to 3fcfb21 Compare May 12, 2026 16:25
Comment thread pkg/settings/limits/errors.go
Comment thread pkg/capabilities/errors/error.go Outdated
@ettec ettec force-pushed the common-limit-errors branch from 17f6baa to faf1127 Compare May 13, 2026 09:17
@ettec ettec added this pull request to the merge queue May 13, 2026
Merged via the queue into main with commit 4fc0bae May 13, 2026
32 checks passed
@ettec ettec deleted the common-limit-errors branch May 13, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants